<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ include file="./tag.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>完善个人资料</title>
<script src="${ctx }/js/jquery.js" type="text/javascript"></script>
<script src="${ctx }/js/ajaxfileupload.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="${ctx }/css/validator.css"></link>
<script src="${ctx }/js/formValidator.js" type="text/javascript" charset="UTF-8"></script>
<script src="${ctx }/js/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
<script src="${ctx }/js/upload.js" type="text/javascript" charset="UTF-8"></script>
<script language="javascript" src="${ctx }/js/DateTimeMask.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
	background-color: #F5C418;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link href="${ctx}/sys/css/angel/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE2 {color: #000000}
.STYLE3 {color: #FFFFFF}
a {color:#5d5c5c;}
a:hover {color:#000000;}
.input1{ margin:-2px 15px 0 2px; background:transparent; border: 0px; width:140px; height:21px}
.input2{ margin:-2px 15px 0 2px; background:transparent; border: 0px; width:56px; height:21px}
.input3{ margin:-2px 15px 0 2px; background:transparent; border: 0px; width:240px; height:21px}
.input4{ margin:-2px 15px 0 2px; background:transparent; border: 0px; width:380px; height:21px}
.input5{ margin:-2px 15px 0 2px; background:transparent; border: 0px; width:280px; height:21px}
.input6{ margin:-2px 15px 0 2px; background:transparent; border: 0px; width:200px; height:20px}




-->
</style>
<script type="text/javascript">
$(document).ready(function() {
	// $.formValidator.initConfig({onerror:function(){alert("校验没有通过，具体错误请看错误提示")}});
	$.formValidator.initConfig({
				formid : "form1",
				alertmessage : true,
				onerror : function(msg) {
					alert(msg)
				},
				onsuccess:function(){alert($('#imagefile1').val());return false;}
			});
	$("#nkName").formValidator({
				oncorrect : "该用户昵称可以注册"
			}).inputValidator({
				min : 1,
				onerror : "用户昵称不能为空,请确认"
			}).ajaxValidator({
				type : "get",
				url : "${ctx }/nickcheck.do",
				datatype : "json",
				success : function(data) {
					if (data == "1") {
						alert("该用户昵称可以注册");
						return true;
					} else {
						alert("该用户昵称已被占用,请更换用户昵称");
						return false;
					}
				},
				buttons : $("#button"),
				error : function() {
					alert("服务器没有返回数据，可能服务器忙，请重试");
				},
				onerror : "该用户昵称已被占用,请更换用户昵称",
				onwait : "正在对用户昵称进行合法性校验，请稍候..."
			}).defaultPassed();
	$("#workYear").formValidator().inputValidator({
				min : 1,
				onerror : "工作年限不能为空,请确认"
			}).regexValidator({
				regexp : "^[1-9]\\d*|0$",
				onerror : "工作年限必须为数字"
			});
	$("#blog").formValidator().inputValidator({
				min : 1,
				onerror : "个人博客不能为空,请确认"
			});
	$("#motto").formValidator().inputValidator({
				min : 1,
				onerror : "座右铭不能为空,请确认"
			});
	$("#declaration").formValidator().inputValidator({
				min : 1,
				onerror : "参赛宣言不能为空,请确认"
			});
	$("#description").formValidator().inputValidator({
				min : 1,
				onerror : "自我描述不能为空,请确认"
			});
	$("#experience").formValidator().inputValidator({
				min : 1,
				onerror : "从业心得不能为空,请确认"
			});
	$("#machineType").formValidator().inputValidator({
				min : 1,
				onerror : "推荐机型不能为空,请确认"
			});
	$("#file1").formValidator().inputValidator({
				min : 1,
				onerror : "请上传用户头像"
			}).regexValidator({
				regexp : "(.*)\\.(jpg)$",
				onerror : "图片必须为jpg格式"
			});
	$("#imagefile1").formValidator().inputValidator({
				min : 1,
				onerror : "请上传用户头像"
			});
	$("#file2").formValidator({
				empty : true
			}).regexValidator({
				regexp : "(.*)\\.(jpg)$",
				onerror : "图片必须为jpg格式"
			});
	$("#file3").formValidator({
				empty : true
			}).regexValidator({
				regexp : "(.*)\\.(jpg)$",
				onerror : "图片必须为jpg格式"
			});
	$("#file4").formValidator({
				empty : true
			}).regexValidator({
				regexp : "(.*)\\.(jpg)$",
				onerror : "图片必须为jpg格式"
			});
	$("#file5").formValidator({
				empty : true
			}).regexValidator({
				regexp : "(.*)\\.(jpg)$",
				onerror : "图片必须为jpg格式"
			});
	$("#file6").formValidator({
				empty : true
			}).regexValidator({
				regexp : "(.*)\\.(jpg)$",
				onerror : "图片必须为jpg格式"
			});
	$("#file7").formValidator({
				empty : true
			}).regexValidator({
				regexp : "(.*)\\.(jpg)$",
				onerror : "图片必须为jpg格式"
			});
	$("#file8").formValidator({
				empty : true
			}).regexValidator({
				regexp : "(.*)\\.(jpg)$",
				onerror : "图片必须为jpg格式"
			});
		/**
		 * $("#password2").formValidator().inputValidator({min:1,onerror:"重复密码不能为空,请确认"}).compareValidator({desid:"password1",operateor:"=",onerror:"2次密码不一致,请确认"});
		 * $(":radio[name='sex']").formValidator({defaultvalue:["2"]}).inputValidator({min:1,max:1,onerror:"性别忘记选了,请确认"});
		 * $("#nl").formValidator().inputValidator({min:1,max:99,type:"value",onerror:"年龄必须在1-99之间，请确认"});
		 * $("#csny").DateTimeMask({"lawlessmessage":"你输入的出生日期格式错误"}).formValidator().inputValidator({min:"1900-01-01",max:"2000-01-01",type:"value",onerror:"日期必须在\"1900-01-01\"和\"2000-01-01\"之间"});
		 * $("#sfzh").formValidator().functionValidator({fun:isCardID});
		 * $("#email").formValidator({defaultvalue:"@"}).inputValidator({min:6,max:100,onerror:"你输入的邮箱长度非法,请确认"}).regexValidator({regexp:"^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$",onerror:"你输入的邮箱格式不正确"});
		 * $("#xueli").formValidator({defaultvalue:"a"}).inputValidator({min:1,onerror:
		 * "你是不是忘记选择学历了!"});
		 * $("#ewjy").formValidator().inputValidator({min:1,onerror:"这里至少要一个字符,请确认"}).functionValidator({
		 * fun:function(val,elem){ if(val=="猫冬"){ return true; }else{ return
		 * "额外校验失败,想额外校验通过，请输入\"猫冬\"" } } });
		 * $("#Tel_country").formValidator({defaultvalue:"86"}).regexValidator({regexp:"^\\d{2}$",onerror:"国家区号不正确"});
		 * $("#Tel_area").formValidator().regexValidator({regexp:"^\\d{3,4}$",onerror:"地区区号不正确"});
		 * $("#Tel_number").formValidator().regexValidator({regexp:"^\\d{7,8}$",onerror:"电话号码不正确"});
		 * $("#Tel_ext").formValidator().regexValidator({regexp:"^\\d{1,5}$",onerror:"分机号码不正确"});
		 * $(":checkbox[name='checkbox1']").formValidator().inputValidator({min:1,onerror:"你选的个数不对(至少选择一个)"});
		 * $(":checkbox[name='checkbox8']").formValidator({defaultvalue:["7","8"]}).inputValidator({min:2,max:3,onerror:"你选的个数不对(至少选择2个,最多选择3个)"});
		 * $(":radio[name='radio']").formValidator({defaultvalue:["4"]}).inputValidator({min:1,max:1,onerror:"难道你不爱国？你给我选！！！！"});
		 * $("#shouji").formValidator({empty:true}).inputValidator({min:11,max:11,onerror:"手机号码必须是11位的,请确认"}).regexValidator({regexp:"mobile",datatype:"enum",onerror:"你输入的手机号码格式不正确"});;
		 * $("#lxdh").formValidator({empty:true}).regexValidator({regexp:"^[[0-9]{3}-|\[0-9]{4}-]?([0-9]{8}|[0-9]{7})?$",onerror:"你输入的联系电话格式不正确"});
		 * $("#ms").formValidator({defaultvalue:"这家伙很懒，什么都没有留下。"}).inputValidator({min:20,onerror:"你输入的描述长度不正确,请确认"});
		 */
	});
function ajaxFileUpload(filename) {
	if ($('#image' + filename).val() == null
			|| $('#image' + filename).val() == "") {
		$("#" + filename + "loading").ajaxStart(function() {
					$(this).show();
				}).ajaxComplete(function() {
					$(this).hide();
				});

		$.ajaxFileUpload({
					url : '${ctx }/upload.do?method=upload' + filename,
					secureuri : false,
					fileElementId : filename,
					dataType : 'json',
					success : function(data, status) {
					
						if (typeof(data.error) != 'undefined') {
						alert(111)
							if (data.error != '') {
							 
								alert(data.error);
							}
						} else {
						    alert(111)
							alert(data.msg);
							$('#' + filename).attr('disabled', true);
							if (data.inputname == 'file1') {
								$('#imagefile1').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file2') {
								$('#imagefile2').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file3') {
								$('#imagefile3').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file4') {
								$('#imagefile4').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file5') {
								$('#imagefile5').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file6') {
								$('#imagefile6').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file7') {
								$('#imagefile7').val(encodeURI(data.filename));
							}
							if (data.inputname == 'file8') {
								$('#imagefile8').val(encodeURI(data.filename));
							}
						}
					},
					error : function(data, status, e) {
						alert(e);
					}
				})
		return false;
	}
}
function upload(inputid) {
	if ($('#image' + inputid).val() == null
			|| $('#image' + inputid).val() == "") {
		if ($.trim($('#' + inputid).val()).length < 1) {
			alert("图片不能为空！请确认");
			return;
		}
		if (!$('#' + inputid)[0].value.match(/.jpg/i)) {
			alert('图片类型必须是jpg格式');
			return;
		}
		var frm = document.form1;
		frm.action = '${ctx }/upload.do?method=upload' + inputid;
		frm.encoding = 'multipart/form-data';
		$("#" + inputid + "loading").show();
		frm.submit();
	}
}
</script>
</head>

<body>
<jsp:include page="./top.jsp" />
<table width="950" height="276" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="222" align="right" valign="top">
	<table width="180" height="221" border="0" cellpadding="0" cellspacing="0" background="${ctx}/sys/images/angel/images/table-three-bg.gif" style="margin:5px 7px 0px 0px">
      <tr>
        <td height="64" align="right" valign="bottom">
		  <table width="179" border="0" cellpadding="0" cellspacing="0" class="song-12-20" style="margin:0px 0px 5px 0px">
          <tr>
            <td width="91" height="23" valign="bottom" bgcolor="#AC8F55"><span class="STYLE2">　　　呢称</span></td>
            <td width="40" valign="bottom" bgcolor="#AC8F55">
			  <span class="STYLE3">票数</span></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="right" valign="bottom">
        <table width="80%" border="0" cellpadding="0" cellspacing="0" class="song-12-20" style="margin:0px 10px 10px 0px">
        <c:forEach items="${voteList}" var="vote" step="1" end="8">
          <tr>
            <td width="91">${vote.nkName }</td>
            <td width="45"><span class="STYLE1">${vote.allVoteNum }</span></td>
          </tr>
        </c:forEach>
        </table></td>
      </tr>
    </table>
	<br /></td>
    <td align="left" valign="top">
	<table width="100%" height="285" border="0" cellpadding="0" cellspacing="0" background="${ctx}/sys/images/angel/images/02-bg-02.gif" style="background-repeat:no-repeat">
      <tr>
        <td align="left" valign="bottom">
        <form action="${ctx}/candidatereg.do" method="post" name="form1" id="form1">
        <input type="hidden" name="promoterId" value="${promoter.promoterId }"/>
        <input type="hidden" name="regId" value="${promoter.regId }"/>
		<div style="background:url(${ctx}/sys/images/angel/images/03-bg-04.gif) no-repeat; margin-bottom:30px"><table style="margin:18px 0px 0px 18px" width="665" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="310" height="22" style=" background-color:"><img src="${ctx}/sys/images/angel/images/03_title-01.gif" width="244" height="22" /></td>
              </tr>
            <tr>
              <td align="left" valign="top">
			  <div style="margin-top:16px; background:url(${ctx}/sys/images/angel/images/03_bg_012.gif) no-repeat; width:643px; height:22px; font:12px #3f3f3f; font-weight:bold; padding:6px 0 0 7px">基础资料</div>
			  <table border="0" cellpadding="0" cellspacing="0" style="border-bottom:#e7e7e7 1px solid; width:655px">
                <tr>
                  <td style="padding:6px 0 12px 7px; font:12px '宋体'; font-color:#5b5b5b; line-height:16px">名字：${promoter.promoterNm }<br/>
					性别：${promoter.gender }<br/>
					所在城市：${promoter.cityIn }<br/>
					所在门店：${promoter.shopNm }<br/></td>
                </tr>
              </table>
			  <div style="margin-top:16px; background:url(${ctx}/sys/images/angel/images/03_bg_012.gif) no-repeat; width:643px; height:22px; font:12px #3f3f3f; font-weight:bold; padding:6px 0 0 7px">详细资料<span style="font-weight:normal; color:#6f6f6f">(填写更多资料可以让人更了解你)</span></div>
			  <table border="0" cellpadding="0" cellspacing="0" style="border-bottom:#e7e7e7 1px solid; width:655px; background:url(${ctx}/sys/images/angel/images/03_regedit_bg.gif) no-repeat; height:226px">
                <tr>
                  <td align="left" valign="top" style="padding:6px 0 12px 7px; font:12px '宋体'; font-color:#5b5b5b; line-height:16px">
				  <table width="531" border="0" cellpadding="0" cellspacing="0" style="margin:3px 0 0 49px">
                    <tr>
                      <td width="368">
                          <input id="nkName" name="nkName" type="text" class="input1" maxlength="10" value="${candidate.nkName }"/>
                              </td>
                      <td width="163"><input id="workYear" name="workYear" type="text" class="input2" value="${candidate.workYear }" maxlength="3"/></td>
                    </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="margin:10px 0 0 75px">
                    <tr>
                      <td>
                          <input id="blog" name="blog" type="text" class="input3" maxlength="200" value="${candidate.blog }"/>
                      </td>
                      </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="margin:8px 0 0 75px">
                    <tr>
                      <td>
                          <input id="motto" name="motto" type="text" class="input4" maxlength="2000" value="${candidate.motto }"/>
                      </td>
                      </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="margin:9px 0 0 75px">
                    <tr>
                      <td>
                          <input id="declaration" name="declaration" type="text" class="input4" maxlength="2000" value="${candidate.declaration }"/>
                      </td>
                      </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="margin:9px 0 0 75px">
                    <tr>
                      <td>
                          <input id="description" name="description" type="text" class="input4" maxlength="2000" value="${candidate.description }"/>
                      </td>
                      </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="margin:9px 0 0 75px">
                    <tr>
                      <td>
                          <input id="experience" name="experience" type="text" class="input4" maxlength="2000" value="${candidate.experience }"/>
                      </td>
                      </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="margin:11px 0 0 95px">
                    <tr>
                      <td>
                          <input id="machineType" name="machineType" type="text" class="input5" maxlength="2000" value="${candidate.machineType }"/>
                      </td>
                      </tr>
                  </table>
				  <br/>
				  <br/>
				  <br/>
				  </td>
                </tr>
              </table>
			  <div style="margin-top:16px; margin-bottom:12px; background:url(${ctx}/sys/images/angel/images/03_bg_012.gif) no-repeat; width:643px; height:22px; font:12px #3f3f3f; font-weight:bold; padding:6px 0 0 7px">上传照片<span style="font-weight:normal; color:#6f6f6f">(图片要求: 选手本人照片，JPG格式，大小不限)</div>
			  <table border="0" cellpadding="0" cellspacing="0" style="border-bottom:#e7e7e7 1px solid; width:655px; height:279px; margin-bottom:15px;">
                <tr>
                  <td align="left" valign="top" style="padding:0px 0 0px 7px; font:12px '宋体'; font-color:#5b5b5b; line-height:16px;">
				  <table border="0" cellpadding="0" cellspacing="0" style="height:21px; margin-bottom:8px">
                    <tr>
                      <td width="280">
						  <input type="hidden" id="imagefile1" name="imagefile1" value="${candidate.imagefile1 }"/><input id="file1" name="file1" type="file" size="30" value="${candidate.imagefile1 }"/><span id="file1success" style="display: none;">上传成功</span>
                      </td>
                      <td width="60"><input type="button" value="上传" onclick="upload('file1');" /></td>
                      <td width="60"><img id="file1loading" src="${ctx }/images/loading.gif" style="display: none;"/></td>
                    </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="height:21px; margin-bottom:8px">
                    <tr>
                      <td width="280">
		                  <input type="hidden" id="imagefile2" name="imagefile2" value="${candidate.imagefile2 }"/><input id="file2" name="file2" type="file" size="30" value="${candidate.imagefile2 }"/><span id="file2success" style="display: none;">上传成功</span>
                      </td>
                      <td width="60"><input type="button" value="上传" onclick="upload('file2');"/></td>
                      <td width="60"><img id="file2loading" src="${ctx }/images/loading.gif" style="display: none;"/></td>
                    </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="height:21px; margin-bottom:8px">
                    <tr>
                      <td width="280"><input type="hidden" id="imagefile3" name="imagefile3" value="${candidate.imagefile3 }"/><input id="file3" name="file3" type="file" size="30" value="${candidate.imagefile2 }"/><span id="file3success" style="display: none;">上传成功</span></td>
                      <td width="60"><input type="button" value="上传" onclick="upload('file3');"/></td>
                      <td width="60"><img id="file3loading" src="${ctx }/images/loading.gif" style="display: none;"/></td>
                    </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="height:21px; margin-bottom:8px">
                    <tr>
                      <td width="280"><input type="hidden" id="imagefile4" name="imagefile4" value="${candidate.imagefile4 }"/><input id="file4" name="file4" type="file" size="30" value="${candidate.imagefile3 }"/><span id="file4success" style="display: none;">上传成功</span></td>
                      <td width="60"><input type="button" value="上传" onclick="upload('file4');"/></td>
                      <td width="60"><img id="file4loading" src="${ctx }/images/loading.gif" style="display: none;"/></td>
                    </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="height:21px; margin-bottom:8px">
                    <tr>
                      <td width="280"><input type="hidden" id="imagefile5" name="imagefile5" value="${candidate.imagefile5 }"/><input id="file5" name="file5" type="file" size="30" value="${candidate.imagefile5 }"/><span id="file5success" style="display: none;">上传成功</span></td>
                      <td width="60"><input type="button" value="上传" onclick="upload('file5');"/></td>
                      <td width="60"><img id="file5loading" src="${ctx }/images/loading.gif" style="display: none;"/></td>
                    </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="height:21px; margin-bottom:8px">
                    <tr>
                      <td width="280"><input type="hidden" id="imagefile6" name="imagefile6" value="${candidate.imagefile6 }"/><input id="file6" name="file6" type="file" size="30" value="${candidate.imagefile6 }"/><span id="file6success" style="display: none;">上传成功</span></td>
                      <td width="60"><input type="button" value="上传" onclick="upload('file6');"/></td>
                      <td width="60"><img id="file6loading" src="${ctx }/images/loading.gif" style="display: none;"/></td>
                    </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="height:21px; margin-bottom:8px">
                    <tr>
                      <td width="280"><input type="hidden" id="imagefile7" name="imagefile7" value="${candidate.imagefile7 }"/><input id="file7" name="file7" type="file" size="30" value="${candidate.imagefile7 }"/><span id="file7success" style="display: none;">上传成功</span></td>
                      <td width="60"><input type="button" value="上传" onclick="upload('file7');"/></td>
                      <td width="60"><img id="file7loading" src="${ctx }/images/loading.gif" style="display: none;"/></td>
                    </tr>
                  </table>
				  <table border="0" cellpadding="0" cellspacing="0" style="height:21px; margin-bottom:8px">
                    <tr>
                      <td width="280"><input type="hidden" id="imagefile8" name="imagefile8" value="${candidate.imagefile8 }"/><input id="file8" name="file8" type="file" size="30" value="${candidate.imagefile8 }"/><span id="file8success" style="display: none;">上传成功</span></td>
                      <td width="60"><input type="button" value="上传" onclick="upload('file8');"/></td>
                      <td width="60"><img id="file8loading" src="${ctx }/images/loading.gif" style="display: none;"/></td>
                    </tr>
                  </table>
				  <br/>
                        <br/>
                        <br/>
                  </td></tr>
              </table>
              
			  <table border="0" cellpadding="0" cellspacing="0" align="center">
                <tr>
                  <td><input id="button" type="submit" value="完成"/></td>
                </tr>
              </table></td>
            </tr>
        </table>
		</div>
		</form>
		</td>
      </tr>
    </table>
    </td>
  </tr>
</table>
<script>
        var msg = "${msg}";
        if('${candidate.imagefile1}' != ''){
            $('#file1').hide();
            $('#file1success').show();
        }
        if('${candidate.imagefile2}' != ''){
            $('#file2').hide();
            $('#file2success').show();
        }
        if('${candidate.imagefile3}' != ''){
            $('#file3').hide();
            $('#file3success').show();
        }
        if('${candidate.imagefile4}' != ''){
            $('#file4').hide();
            $('#file4success').show();
        }
        if('${candidate.imagefile5}' != ''){
            $('#file5').hide();
            $('#file5success').show();
        }
        if('${candidate.imagefile6}' != ''){
            $('#file6').hide();
            $('#file6success').show();
        }
        if('${candidate.imagefile7}' != ''){
            $('#file7').hide();
            $('#file7success').show();
        }
        if('${candidate.imagefile8}' != ''){
            $('#file8').hide();
            $('#file8success').show();
        }
        if(msg != null && msg != ''){
            alert(msg);
        }
</script>
		<jsp:include page="./foot.jsp" />
</body>
</html>
